//package com.ptu.spzx.common.interceptor;
//
//import com.alibaba.fastjson.JSON;
//import com.ptu.spzx.model.entity.user.UserInfo;
//import com.ptu.utils.AuthContextUtil;
//
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.web.servlet.HandlerInterceptor;
//
//
//
//
//public class UserLoginAuthInterceptor implements HandlerInterceptor {
//
//    @Autowired
//    private RedisTemplate<String , String> redisTemplate ;
//
//
//    @Override
//     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
//            throws Exception {
//        String token = request.getHeader("token");
//        String userJson = redisTemplate.opsForValue().get("user:spzx" + token);
//        //放到threadLocal里面
//        AuthContextUtil.setUserInfo(JSON.parseObject(userJson, UserInfo.class));
//        return true;
//    }
//}
